<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.ListMenuTitle}"></h:outputText>
        </ui:define>

        <ui:define name="body">
            <h:panelGroup styleClass="list" layout="block">
                <h:outputText escape="false" value="#{bundle.ListMenuEmpty}" rendered="#{menuController.items.rowCount == 0}"/>
                <h:panelGroup rendered="#{menuController.items.rowCount > 0}">
                    <h:outputText value="Nombre de menu : #{menuController.pagination.itemsCount}"/>&nbsp;
                    <h:commandLink action="#{menuController.previous}" value="#{bundle.Previous} #{menuController.pagination.pageSize}" rendered="#{menuController.pagination.hasPreviousPage}"/>&nbsp;
                    <h:commandLink action="#{menuController.next}" value="#{bundle.Next} #{menuController.pagination.pageSize}" rendered="#{menuController.pagination.hasNextPage}"/>&nbsp;
                    <h:dataTable value="#{menuController.items}" var="item" border="0" cellpadding="2" cellspacing="0" rowClasses="jsfcrud_odd_row,jsfcrud_even_row" rules="all" style="border:solid 1px">

                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListMenuTitle_nom}"/>
                            </f:facet>
                            <h:outputText value="#{item.nom}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListMenuTitle_montant}"/>
                            </f:facet>
                            <h:outputText value="#{item.montant} €"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListMenuTitle_dateDebut}"/>
                            </f:facet>
                            <h:outputText value="#{item.dateDebut}">
                                <f:convertDateTime pattern="dd/MM/yyyy" />
                            </h:outputText>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListMenuTitle_dateFin}"/>
                            </f:facet>
                            <h:outputText value="#{item.dateFin}">
                                <f:convertDateTime pattern="MM/dd/yyyy HH:mm:ss" />
                            </h:outputText>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListMenuTitle_promotion}"/>
                            </f:facet>
                            <h:outputText value="#{item.promotion}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="&nbsp;"/>
                            </f:facet>
                            <h:commandLink styleClass="details" action="#{menuController.prepareView}" value="#{bundle.ListMenuViewLink}"/>
                            <br></br>
                            <h:commandLink styleClass="modifier" action="#{menuController.prepareEdit}" value="#{bundle.ListMenuEditLink}"/>
                            <br></br>
                            <h:commandLink styleClass="supprimer" action="#{menuController.destroy}" value="#{bundle.ListMenuDestroyLink}"/>
                        </h:column>



                    </h:dataTable>
                </h:panelGroup>
                <br />
                <h:panelGroup styleClass="boutons" layout="block">
                    <h:commandLink styleClass="ajouter" action="#{menuController.prepareCreate}" value="#{bundle.ListMenuCreateLink}"/>
                </h:panelGroup>
            </h:panelGroup>
        </ui:define>
    </ui:composition>

</html>
